EVAL Library for VB/DOS CONTENT A - What you see B - What you've got... C - What you may get D - How to use the EVAL-Utility E - Miscellaneous A What you see ------------ EVAL01.OBJ - Object-File containing the EVAL-Utility EVAL.EXE - Example: This program requires VBDRT10E.EXE EVAL.QLB - QuickLibrary containing the EVAL-Utility EVAL.LIB - Library for linking exe-files EVAL02.FRM - Example: This shows how to use the EVAL-Utility EVAL.TXT - You are reading this file. DEUTSCH.TXT - EVAL.TXT in german. CHECKOUT.BAT - Batch that loads VBDOS with the example B What you've got... ------------------ is a complete library (QLB and LIB) customized for VBDOS programmers. Now you can write programs that can evaluate arithmetic expressions entered by the users of your app. Supported functions are: - addition (+) - substraction (-) - multiplication (*) - division (/) - exponentiation (^) - negation (-) Supported decimal seperators: - . US - , Germany Supported formatting of the results: US Germany ------------------------------ - left alignment linksbndig - right alignment rechtsbndig - centered zentriert Supported controls: - label - textbox - combobox C What you may get ---------------- although this library contains everything you need to create exefiles, you need the sources if you want to know how the eval utility really works. The docs that come with the sources show you how its been done. They also shed light on topics like "Using binary-flags" and "designing and writing recursive functions". This offer is available in english and german and it really is a bargain. Docs and sources are avialable for $10 or DM 15 incl. shipment. It's available on 3.5" discettes or via E-Mail, if you are a member of the CompuServe Network. E-Mail - benwar@compuserve.com Snail mail: - Peter Benwar-Wagner Sensburger Str. 7 42859 Remscheid Germany D How to use the EVAL-Utility --------------------------- 1. a) start CHECKOUT.BAT or b) invoce vbdos: VBDOS /L EVAL.QLB /AH/ES - check out EVAL02.FRM 2. Procedures your application needs to know: DECLARE FUNCTION EvalReg% () DECLARE SUB EvalSetcboFmt (a AS CONTROL, b AS CONTROL) DECLARE FUNCTION evaluate% (TextBox AS CONTROL, Label AS CONTROL, fmt$) EvalReg% returns TRUE if registration succeeded. Your app needs to register the EVAL functions, because the library needs to know some country specific settings (i.e. decimal seperator) and it needs allocating space for later use. Before using any of the Eval-Lib Routines make shure your app executed EvalReg first. a typical Registration: IF EvalReg THEN ' if registration succeeded ... EvalSetcboFmt cboFmt, cboAlignment cboFmt.ListIndex = 0 cboAlignment.ListIndex = 0 ELSE ' if registration failed you may not use any of the ' eval-lib-routines UNLOAD frmEval02 END IF the EvalSetcboFmt SUB filles two Combo-Boxes. cboFmt contains numeric formats like BASICS Format$-Function with the exeption that it is country sensitive. That means in Germany we format the number 0.5 as 0,5 that is why German users prefere to see a format string like "0,0" rather than the confusing "0.0". Users in the US prefere "0.0" of course. EvalSetcboFmt is an easy to use programmers interface. Because the eval-lib does the job you don't have to worry about decimal seperators anymore. The seconds Combo, cboAlignment, will be filled with appropiate alignments that fit the lable.alignment property: 0=left alingment 1=right alignment 2=centered. In Germany useres prefere "rechtsbndig" "linksbndig" and "zentriert". EvalSetcboFmt gives them what they need, because it evaluates contryspecific settings at runtime. If you need other country specific information please register this library. You may customize the sources and create your own lib. this a typical sequence within an evaluating event. ' 1st retrive the Format-String fmt$ = cboFmt.Text ' 2nd assign the result of Function evaluate to integer TEST ' txtFormular is a TextBox-Control which TEXT-Property contains ' an arithmetic expression for evaluation, FMT$ is the format ' string. lblResult is a Label-Control that evaluate needs for ' storing the formatted result as caption property. test=evaluate(txtFormular, lblResult,fmt$) ' evaluate returns some of Basics error codes. If ' it returns FALSE then evaluation succeeded otherwise ' inform the user that something went wrong: IF Test THEN MSGBOX ERROR$(Test), 0, caption The function evaluate needs three parameters. First the TextBox control which TEXT property contains an arithmetic expression. Second a Label control. Evaluate prints the result of the artithmetic expression to its CAPTION property. Third: The formatting parameter FMT$. evaluate needs this one for formatting the result before it stores it to the CAPTION property of the label. A Null-String means: No formatting. E Miscellaneousness ----------------- the EVAL.LIB uses double precision floatingpoint numbers for its calculation. EVAL01.OBJ was created by the following line: bc eval01.bas /g3/ah/t/c:512 Peter Benwar-Wagner is the author of this EVAL.LIB. EVAL.LIB is freeware as long as you use it privately. If you link it to commercial, shareware or freeware applications you have to register it. You may also want to register it, if you need to change or enhance its functionality. Copyright 1997 by Peter Benwar-Wagner, Remscheid, Germany. All rights reserved.